Tracking a subdomain serately within the main domain account [closed]
Posted
by
Vinay
on Super User
See other posts from Super User
or by Vinay
Published on 2012-07-06T06:46:39Z
Indexed on
2012/07/06
21:19 UTC
Read the original article
Hit count: 261
JavaScript
|subdomain
I have a website, for example: xyz.com
and info.xyz.com
. I created a profile for xyz
and tracking is good. I added a new profile for info.xyz.com
in xyz.com
.
Analytics tracking for info.xyz.com
is showing traffic from both xyz.com
and info.xyz.com
.
How do I change to show only info.xyz
traffic in the info.xyz.com
profile. I used the following code:
Analytics code for xyz.com domain:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxx-x']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
Analytics code for info.xyz.com
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxx-x']);
_gaq.push(['_setDomainName', 'xyz.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
© Super User or respective owner